<div class="grid-list page-content ">
	<form nz-form [formGroup]="validateForm" class="page-header">
		<div nz-row [nzGutter]="24">
			<div nz-col [nzSpan]="6">
				<nz-form-item>
					<nz-form-label nzFor="beanName">任务名称</nz-form-label>
					<nz-form-control>
						<input nz-input placeholder="请填写" formControlName="beanName" />
					</nz-form-control>
				</nz-form-item>
			</div>

			<div nz-col [nzSpan]="6" [nzOffset]="12">
				<nz-form-item style="float: right;">
					<button *ngIf="authList.includes(authEnum.BASE_SCHEDULE_VIEW)" nz-button (click)="onSearch(true)">
						<i nz-icon nzType="search"></i>
						搜索
					</button>
					<!-- <button nz-button nzType="primary" (click)="add()">
						<i nz-icon nzType="plus"></i>
						新增
					</button> -->
				</nz-form-item>
			</div>

		</div>

	</form>


	<nz-table #basicTable [nzData]="data" [nzBordered]="true" [nzShowPagination]="false" nzSize="middle"
		[nzScroll]="{y:  'calc(100vh - 190px'}" [nzLoading]="nzLoading" [nzPageSize]="page.limit">
		<thead>
			<tr>
				<th nzAlign="center" nzWidth="50px">序号</th>
				<th nzAlign="center" nzWidth="180px">bean名称</th>
				<th nzAlign="center" nzWidth="180px">参数</th>
				<th nzAlign="center" nzWidth="auto">cron表达式</th>
				<th nzAlign="center" nzWidth="auto">备注</th>
				<th nzAlign="center" nzWidth="100px">状态</th>
				<th nzAlign="center" nzWidth="260px">操作</th>
			</tr>
		</thead>
		<tbody>
			<tr *ngFor="let item of basicTable.data; let i = index;">
				<td nzAlign="center">{{ i + 1}}</td>
				<td nzAlign="center">
					{{item?.beanName}}
				</td>
				<td nzAlign="center">
					<span class="line-clamp" nz-tooltip [nzTooltipTitle]="item?.params">
						{{item?.params}}
					</span>
				</td>
				<td nzAlign="center">
					{{item?.cronExpression}}
				</td>
				<td nzAlign="center">
					<span class="line-clamp" nz-tooltip [nzTooltipTitle]="item?.remark">
						{{item?.remark}}
					</span>
				</td>
				<td nzAlign="center">
					{{item.status === 1 ? '暂停' : '正常' }}
				</td>
				<td nzAlign="center">
					<ng-container *ngIf="authList.includes(authEnum.BASE_SCHEDULE_EDIT)">
						<a (click)="add(item)">编辑</a>
						<nz-divider nzType="vertical"></nz-divider>
					</ng-container>
					<ng-container *ngIf="authList.includes(authEnum.BASE_SCHEDULE_DEL)">
						<a nz-popconfirm nzPopconfirmTitle="确定删除吗?" (nzOnConfirm)="del(item)">删除</a>
						<nz-divider nzType="vertical"></nz-divider>
					</ng-container>
					
					<ng-container *ngIf="item.status === 1 && authList.includes(authEnum.BASE_SCHEDULE_RESUME)">
						<a nz-popconfirm nzPopconfirmTitle="确定恢复吗?" (nzOnConfirm)="resume(item)">恢复</a>
						<nz-divider nzType="vertical"></nz-divider>

					</ng-container>
					<ng-container *ngIf="item.status === 0 && authList.includes(authEnum.BASE_SCHEDULE_PAUSE)">
						<a nz-popconfirm nzPopconfirmTitle="确定暂停吗?" (nzOnConfirm)="pause(item)">暂停</a>
						<nz-divider nzType="vertical"></nz-divider>
					</ng-container>
					<ng-container *ngIf="authList.includes(authEnum.BASE_SCHEDULE_RUN)">
						<a nz-popconfirm nzPopconfirmTitle="确定立即执行吗?" (nzOnConfirm)="run(item)">立即执行</a>
					</ng-container>

				</td>
			</tr>
		</tbody>
	</nz-table>

	<div class="page-pagination">
		<span *ngIf="page.total">共{{page.total}}条数据</span>
		<nz-pagination [(nzPageIndex)]="page.page" [nzTotal]="page.total" nzShowQuickJumper nzShowSizeChanger
			[(nzPageSize)]="page.limit" (nzPageIndexChange)="onSearch()" (nzPageSizeChange)="onSearch(true)">
		</nz-pagination>
	</div>

</div>